import { HttpRequest } from 'xo-web-base';
import Slide from '../models/slide';
/**
 * 验证码接口
 */
export default class SmsService {
  /**
   * 获取滑块验证码
   * @returns
   */
  static getSliderCaptcha() {
    return HttpRequest.post<Slide>('/web/user/generateSliderCaptcha', {});
  }

  /**
   * 发送验证码
   * @param mobile
   * @param sendType 验证码类型 1-手机号注册 2-修改密码获取验证码
   * @param id  滑块id
   * @param percentage 滑块距离
   * @returns
   */
  static sendSms(
    mobile: string,
    sendType: number,
    id: string,
    percentage: number,
  ) {
    return HttpRequest.post<Slide>('/web/user/sendSms', {
      form: {
        mobile: mobile,
        sendType: sendType,
      },
      id: id,
      percentage: percentage,
    });
  }
}
